package ltd.dujiabao.cmsservice.service.impl;

import lombok.extern.slf4j.Slf4j;
import ltd.dujiabao.cmsservice.entity.CrmBanner;
import ltd.dujiabao.cmsservice.mapper.CrmBannerMapper;
import ltd.dujiabao.cmsservice.service.CrmBannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author dujiabao
 * @since 2021-04-24
 */
@Service
@Slf4j
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerMapper, CrmBanner> implements CrmBannerService {
  // 加了一个redis缓存，免得经常查询数据库
  @Cacheable(value = "banner", key = "'getAllBannerList'")  // value类似于分组，key为键，在redis会表现为`banner::getAllBannerList`
  @Override
  public List<CrmBanner> getAllBannerList() {
    List<CrmBanner> list = list(null);
    log.info("通过sql查询获得结果：" + list.toString());
    return list;
  }
}
